package no.ntnu.item.ttm4115.termproject.extrasagent;


public class ExtrasAgentCS extends no.tellu.common.actorframe.ActorCS {


    protected no.tellu.common.javaframe.State ready = new no.tellu.common.javaframe.State("ready", this);

    public ExtrasAgentCS() {
        super();
    }


    public void execTrans(no.tellu.common.javaframe.messages.ActorMsg signal, no.tellu.common.javaframe.State state, no.tellu.common.javaframe.StateMachine curfsm){
        super.execTrans(signal, state, curfsm);
System.out.println("    Actor " + signal.getReceiverRole() + " received " + signal.getSignalName() + ".");;
        no.ntnu.item.ttm4115.termproject.extrasagent.ExtrasAgentSM asm = (no.ntnu.item.ttm4115.termproject.extrasagent.ExtrasAgentSM) curfsm;
        if(state == ready) {
            if(signal instanceof no.ntnu.item.ttm4115.termproject.SendGMAddressToTeacher) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.ReturnPlayersForGroupCreation) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.PrepareNewGroupToCM) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.PlayerAddedGroup) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.SendRoleRequestToNewGroup) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.SendTreasureToConfigAgent) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.UpdateTreasureInXML) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.DeleteTreasureFromGUI) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.UpdateGroupFromGUI) {
                performExit(curfsm);
                nextState(ready, curfsm);
            } else if(signal instanceof no.ntnu.item.ttm4115.termproject.DeleteGroupFromGUI) {
                performExit(curfsm);
                nextState(ready, curfsm);
            }
        } else if(state == idle) {
            if(signal instanceof no.tellu.common.actorframe.messages.StartPlayingMsg) {
                System.out.println("Start of " + ((no.tellu.common.actorframe.messages.StartPlayingMsg)signal).getReceiverRole());
                performExit(curfsm);
                nextState(ready, curfsm);
            }
        }
    }
}
